import { aspects } from './aspects'
import { Vector3 } from '../Math/Vector3'
import { Foliage } from '../PCG/Foliage'
const foliagelist: Array<Foliage> = [];
export const drawFoliage = {
    // 绘制墙体
    draw(type: number) {
        aspects.multipoint(false,(data: any) => { 
            const list = data.pointList
            this.addFoliage(list, type)
            this.stopWall()
            return data
        })
    },

    addFoliage(list: Array<Vector3>, type: number) {
        const foliage = new Foliage(list, type)
        foliage.setLonLatPosition(list[0])
        foliagelist.push(foliage)
    },

    removeAllFoliage() {
        for (const foliage of foliagelist) {
            foliage.delete()
        }
        foliagelist.splice(0, foliagelist.length)
    },

    // 停止绘制
    stopWall() {
        aspects.stopTwoAspects()
    }
}

